<template>
  <div class="right-middle">
    <div class="base-board" v-for="item in boardList" :key="item.id">
      <div class="manage-title">
        <img :src="getImage('home',item.img)" alt>
        <span>{{item.title}}</span>
      </div>
      <div class="manage-content">
        <div
          class="manage-item"
          v-for="(el,key) in item.arr"
          :style="{paddingTop:el.progress?'16px':''}"
        >
          <div class="item-num">
            <i>{{$filters.numFormat(el.num)}}</i>
            {{el.unit}}
          </div>
          <div class="item-name">{{el.name}}</div>
          <div class="progress" style="width:108px;" v-if="el.progress">
            <el-progress :color="'#64FEFF'" :percentage="el.progress">
              <span class="percent-text">{{el.progress}}%</span>
            </el-progress>
          </div>
        </div>
      </div>
      <div class="arrow" v-if="item.arrow">
        <img src="@/assets/image/home/arrow.png" alt>
      </div>
    </div>
  </div>
</template>

<script>
import { ref, reactive, toRefs } from "vue";
import { getImageUrl } from '@/util'


export default {
  setup(props) {
    const obj = reactive({
      boardList: [
        {
          id: 1,
          title: "人口",
          img: "people",
          arrow: true,
          arr: [
            {
              name: "常驻人口",
              num: 734.48,
              progress: null,
              unit: "万人"
            },
            {
              name: "户籍人口",
              num: 781.97,
              progress: null,
              unit: "万人"
            },
            {
              name: "境外输入人口",
              num: 5.48,
              progress: null,
              unit: "万人"
            },
            {
              name: "中高风险地区输入",
              num: 0,
              progress: null,
              unit: "人"
            }
          ]
        },
        {
          id: 2,
          title: "组织",
          img: "organization",
          arrow: false,
          arr: [
            {
              name: "娱乐场所",
              num: 345,
              progress: 98,
              unit: "个"
            },
            {
              name: "特种行业",
              num: 153,
              progress: 88,
              unit: "个"
            },
            {
              name: "内保单位",
              num: 480,
              progress: 82,
              unit: "个"
            },
            {
              name: "安保公司",
              num: 80,
              progress: 80,
              unit: "个"
            }
          ]
        },
        {
          id: 3,
          title: "物品",
          img: "goods",
          arrow: true,
          arr: [
            {
              name: "肇事逃逸车",
              num: 310,
              progress: null,
              unit: "辆"
            },
            {
              name: "两客一危",
              num: 344,
              progress: null,
              unit: "辆"
            },
            {
              name: "其他重点车辆",
              num: 1534,
              progress: null,
              unit: "辆"
            },
            {
              name: "假/套牌车",
              num: 78,
              progress: null,
              unit: "人"
            }
          ]
        }
      ]
    });

    let getImage = getImageUrl

    return { ...toRefs(obj),getImage };
  }
};
</script>


<style lang="scss" scoped>
.right-middle {
  width: 100%;
  height: 290px;
  padding: 16px 22px;
  .base-board {
    width: 610px;
    height: 81px;
    background-image: url("@/assets/image/home/base.png");
    background-size: 100% 100% no-repeat;
    border: 1px solid rgba(56, 140, 255, 0.4);
    opacity: 1;
    border-radius: 2px;
    margin-bottom: 12px;
    padding-left: 96px;
    position: relative;
    &:last-child {
      margin: 0;
    }
    .manage-title {
      width: 69px;
      height: 69px;
      position: absolute;
      left: 9px;
      top: 1px;
      @include flex-column-center;
      span {
        margin-top: 1px;
        font-size: 12px;
        font-family: Source Han Sans CN;
        font-weight: bold;
        color: #ffffff;
      }
      img {
        width: 100%;
        height: 53px;
      }
    }
    .manage-content {
      padding-left: 19px;
      height: 100%;
      @include flex;
      // justify-content: space-around;
      .manage-item {
        width: 100px;
        height: 100%;
        display: flex;
        flex-direction: column;
        padding-top: 22px;
        margin-left: 20px;
        .item-num {
          font-size: 12px;
          font-family: DIN Next LT Pro;
          font-weight: 500;
          color: #cbddff;
          i {
            font-size: 18px;
            color: #64feff;
          }
        }
        .item-name {
          font-size: 12px;
          color: #cbddff;
          font-family: Source Han Sans CN;
        }
        .progress {
          .percent-text {
            font-size: 16px;
            font-family: DIN Next LT Pro;
            font-weight: bold;
            color: #64feff;
          }
        }
        &:first-child {
          margin-left: 0;
        }
        &:last-child {
          width: 130px;
        }
      }
    }
    .arrow {
      position: absolute;
      right: 15px;
      top: 30px;
      img {
        width: 10px;
        height: 19px;
      }
    }
  }
}
</style>

<style lang="scss">
.base-board {
  .el-progress-bar__outer {
    background: rgba(108, 254, 255, 0.2);
  }
}
</style>
